# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[return self._subargs[self.get_item_list('main_list').selected_pos]
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb775b22c>}
nname: 0
n 0(None)[return self._submenus[self.get_item_list('main_list').selected_pos]
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb775b2cc>}
nname: 270
n 270(None)[return None
]:
	i: 205(), 257()
	o: 

nname: 257
n 257(None)[self.set_selected_submenu = self.set_submenu
]:
	i: 126(f)
	o: 270()

nname: 205
n 205(None)[self.task_set = Task(self.set_submenu)
self.task_set.delay = self.lazy_selection_delay
self.set_selected_submenu = self.task_set.start
]:
	i: 126(t)
	o: 270()

nname: 126
n 126(self.lazy_selection_delay is not None)[self._subpos = -2
self._getitems_keywords.update(dict(submenu_selected=(lambda : self._submenus[self.get_item_list('main_list').selected_pos]), subargs_selected=(lambda : self._subargs[self.get_item_list('main_list').selected_pos])))
self._last_selected_pos = -1
]:
	i: 115(), 122()
	o: 205(t), 257(f)

nname: 122
n 122(None)[]:
	i: 97(f)
	o: 126()

nname: 115
n 115(None)[]:
	i: 97(t)
	o: 126()

nname: 97
n 97(subpos is not None)[self._subargs = []
]:
	i: 86(), 93()
	o: 115(t), 122(f)

nname: 93
n 93(None)[]:
	i: 68(f)
	o: 97()

nname: 86
n 86(None)[]:
	i: 68(t)
	o: 97()

nname: 68
n 68(subargs is not None)[self._submenus = []
]:
	i: 57(), 64()
	o: 86(t), 93(f)

nname: 64
n 64(None)[]:
	i: 35(f)
	o: 68()

nname: 57
n 57(None)[]:
	i: 35(t)
	o: 68()

nname: 35
n 35(submenus is not None)[Menu.__init__(self, name, [], *args, **kw)
]:
	i: 24(), 31()
	o: 57(t), 64(f)

nname: 31
n 31(None)[]:
	i: 0(f)
	o: 35()

nname: 24
n 24(None)[]:
	i: 0(t)
	o: 35()

nname: 0
n 0(choices is not None)[]:
	i: 
	o: 24(t), 31(f)

nname: 126
n 126(None)[self._subpos = -2
self._getitems_keywords.update(dict(submenu_selected=(lambda : self._submenus[self.get_item_list('main_list').selected_pos]), subargs_selected=(lambda : self._subargs[self.get_item_list('main_list').selected_pos])))
self._last_selected_pos = -1
if self.lazy_selection_delay is not None:
	self.task_set = Task(self.set_submenu)
	self.task_set.delay = self.lazy_selection_delay
	self.set_selected_submenu = self.task_set.start
else:
	self.set_selected_submenu = self.set_submenu
return None
]:
	i: 68()
	o: 

nname: 68
n 68(None)[self._submenus = []
if subargs is not None:
	pass
self._subargs = []
if subpos is not None:
	pass
]:
	i: 0()
	o: 126()

nname: 0
n 0(None)[if choices is not None:
	pass
Menu.__init__(self, name, [], *args, **kw)
if submenus is not None:
	pass
]:
	i: 
	o: 68()

nname: 126
n 126(None)[self._subpos = -2
self._getitems_keywords.update(dict(submenu_selected=(lambda : self._submenus[self.get_item_list('main_list').selected_pos]), subargs_selected=(lambda : self._subargs[self.get_item_list('main_list').selected_pos])))
self._last_selected_pos = -1
if self.lazy_selection_delay is not None:
	self.task_set = Task(self.set_submenu)
	self.task_set.delay = self.lazy_selection_delay
	self.set_selected_submenu = self.task_set.start
else:
	self.set_selected_submenu = self.set_submenu
return None
]:
	i: 0()
	o: 

nname: 0
n 0(None)[if choices is not None:
	pass
Menu.__init__(self, name, [], *args, **kw)
if submenus is not None:
	pass
self._submenus = []
if subargs is not None:
	pass
self._subargs = []
if subpos is not None:
	pass
]:
	i: 
	o: 126()

nname: 0
n 0(None)[if choices is not None:
	pass
Menu.__init__(self, name, [], *args, **kw)
if submenus is not None:
	pass
self._submenus = []
if subargs is not None:
	pass
self._subargs = []
if subpos is not None:
	pass
self._subpos = -2
self._getitems_keywords.update(dict(submenu_selected=(lambda : self._submenus[self.get_item_list('main_list').selected_pos]), subargs_selected=(lambda : self._subargs[self.get_item_list('main_list').selected_pos])))
self._last_selected_pos = -1
if self.lazy_selection_delay is not None:
	self.task_set = Task(self.set_submenu)
	self.task_set.delay = self.lazy_selection_delay
	self.set_selected_submenu = self.task_set.start
else:
	self.set_selected_submenu = self.set_submenu
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7750dcc>}
nname: 156
n 156(None)[submenu.switch_sub_menu(subpos)
self.submenu_selected = submenu
self._last_selected_pos = selected_pos
return None
]:
	i: 96(AL), 155()
	o: 

nname: 155
n 155(None)[]:
	i: 99(AF), 151()
	o: 156()

nname: 151
n 151(None)[]:
	i: 119(f), 146()
	o: 155()

nname: 146
n 146(None)[break
continue
]:
	i: 119(t)
	o: 151()

nname: 119
n 119(menu.type.startswith('notebook'))[for subpos, menu in enumerate(pygui_globs['menustack'].menus_stack):
]:
	i: 99(for)
	o: 146(t), 151(f)

nname: 99
n 99(None)[]:
	i: 96(loop)
	o: 119(for), 155(AF)

nname: 96
n 96(None)[]:
	i: 45(), 69()
	o: 99(loop), 156(AL)

nname: 69
n 69(None)[submenu = self._submenus[num_page](**self._subargs[num_page])
]:
	i: 33(f)
	o: 96()

nname: 45
n 45(None)[submenu = self['submenu_selected'](**self['subargs_selected'])
]:
	i: 33(t)
	o: 96()

nname: 33
n 33(num_page is None)[]:
	i: 24(), 32()
	o: 45(t), 69(f)

nname: 32
n 32(None)[]:
	i: 0(f)
	o: 33()

nname: 24
n 24(None)[return None
]:
	i: 0(t)
	o: 33()

nname: 0
n 0(selected_pos == self._last_selected_pos)[selected_pos = self.selected_pos
]:
	i: 
	o: 24(t), 32(f)

nname: 156
n 156(None)[submenu.switch_sub_menu(subpos)
self.submenu_selected = submenu
self._last_selected_pos = selected_pos
return None
]:
	i: 96(AL), 99(AF), 119()
	o: 

nname: 119
n 119(None)[for subpos, menu in enumerate(pygui_globs['menustack'].menus_stack):
if menu.type.startswith('notebook'):
	break
	continue
]:
	i: 99(for)
	o: 156()

nname: 99
n 99(None)[]:
	i: 96(loop)
	o: 119(for), 156(AF)

nname: 96
n 96(None)[]:
	i: 0()
	o: 99(loop), 156(AL)

nname: 0
n 0(None)[selected_pos = self.selected_pos
if selected_pos == self._last_selected_pos:
	return None
if num_page is None:
	submenu = self['submenu_selected'](**self['subargs_selected'])
else:
	submenu = self._submenus[num_page](**self._subargs[num_page])
]:
	i: 
	o: 96()

nname: 156
n 156(None)[submenu.switch_sub_menu(subpos)
self.submenu_selected = submenu
self._last_selected_pos = selected_pos
return None
]:
	i: 99()
	o: 

nname: 99
n 99(None)[for subpos, menu in enumerate(pygui_globs['menustack'].menus_stack):
	if menu.type.startswith('notebook'):
		break
		continue
]:
	i: 0(loop)
	o: 156()

nname: 0
n 0(None)[selected_pos = self.selected_pos
if selected_pos == self._last_selected_pos:
	return None
if num_page is None:
	submenu = self['submenu_selected'](**self['subargs_selected'])
else:
	submenu = self._submenus[num_page](**self._subargs[num_page])
]:
	i: 
	o: 99(loop)

nname: 156
n 156(None)[submenu.switch_sub_menu(subpos)
self.submenu_selected = submenu
self._last_selected_pos = selected_pos
return None
]:
	i: 0()
	o: 

nname: 0
n 0(None)[selected_pos = self.selected_pos
if selected_pos == self._last_selected_pos:
	return None
if num_page is None:
	submenu = self['submenu_selected'](**self['subargs_selected'])
else:
	submenu = self._submenus[num_page](**self._subargs[num_page])
for subpos, menu in enumerate(pygui_globs['menustack'].menus_stack):
	if menu.type.startswith('notebook'):
		break
		continue
]:
	i: 
	o: 156()

nname: 0
n 0(None)[selected_pos = self.selected_pos
if selected_pos == self._last_selected_pos:
	return None
if num_page is None:
	submenu = self['submenu_selected'](**self['subargs_selected'])
else:
	submenu = self._submenus[num_page](**self._subargs[num_page])
for subpos, menu in enumerate(pygui_globs['menustack'].menus_stack):
	if menu.type.startswith('notebook'):
		break
		continue
submenu.switch_sub_menu(subpos)
self.submenu_selected = submenu
self._last_selected_pos = selected_pos
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb775062c>}
nname: 0
n 0(None)[self['main_list'].append(item)
self._submenus.append(menu)
self._subargs.append(args)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7748d8c>}
nname: 0
n 0(None)[return (self['main_list'][rank], self._submenus[rank])
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7748b0c>}
nname: 72
n 72(None)[return (None, None)
]:
	i: 0(AL), 71()
	o: 

nname: 71
n 71(None)[]:
	i: 3(AF), 67()
	o: 72()

nname: 67
n 67(None)[]:
	i: 29(f), 53()
	o: 71()

nname: 53
n 53(None)[return (it, menu)
continue
]:
	i: 29(t)
	o: 67()

nname: 29
n 29(it.name == name)[for it, menu in itertools.izip(self['main_list'], self._submenus):
]:
	i: 3(for)
	o: 53(t), 67(f)

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 29(for), 71(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 72(AL)

nname: 72
n 72(None)[return (None, None)
]:
	i: 0(AL), 3(AF), 29()
	o: 

nname: 29
n 29(None)[for it, menu in itertools.izip(self['main_list'], self._submenus):
if it.name == name:
	return (it, menu)
	continue
]:
	i: 3(for)
	o: 72()

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 29(for), 72(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 72(AL)

nname: 29
n 29(None)[for it, menu in itertools.izip(self['main_list'], self._submenus):
	if it.name == name:
		return (it, menu)
		continue
return (None, None)
]:
	i: 0(for)
	o: 

nname: 0
n 0(None)[]:
	i: 
	o: 29(for)

nname: 0
n 0(None)[for it, menu in itertools.izip(self['main_list'], self._submenus):
	if it.name == name:
		return (it, menu)
		continue
return (None, None)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7748eec>}
nname: 103
n 103(None)[]:
	i: 85(), 89(), 102(AE)
	o: 

nname: 89
n 89(None)[PRINT_EXCEPTION()
]:
	i: 0(except)
	o: 103()

nname: 85
n 85(None)[]:
	i: 70(), 84()
	o: 103()

nname: 84
n 84(None)[]:
	i: 16(f)
	o: 85()

nname: 70
n 70(None)[self.set_selected_submenu()
]:
	i: 16(t)
	o: 85()

nname: 16
n 16(old_selected_pos >= rank)[menu = self._submenus.pop(rank)
del self['main_list'][rank]
new_selected_pos = self['main_list'].selected_pos
]:
	i: 0(try)
	o: 70(t), 84(f)

nname: 0
n 0(None)[old_selected_pos = self['main_list'].selected_pos
]:
	i: 
	o: 16(try), 89(except)

nname: 103
n 103(None)[]:
	i: 89(), 0()
	o: 

nname: 89
n 89(None)[except:
	PRINT_EXCEPTION()
]:
	i: 0()
	o: 103()

nname: 103
n 103(None)[]:
	i: 89(), 0()
	o: 

nname: 0
n 0(None)[old_selected_pos = self['main_list'].selected_pos
try:
	menu = self._submenus.pop(rank)
	del self['main_list'][rank]
	new_selected_pos = self['main_list'].selected_pos
	if old_selected_pos >= rank:
		self.set_selected_submenu()
]:
	i: 
	o: 103(), 89()

self.nodes: {0: <unpyclib.structure.node instance at 0xb7748e8c>, 103: <unpyclib.structure.node instance at 0xb7748d0c>, 89: <unpyclib.structure.node instance at 0xb7748eac>}
nname: 178
n 178(None)[return None
]:
	i: 110(), 177()
	o: 

nname: 177
n 177(None)[]:
	i: 0(f)
	o: 178()

nname: 110
n 110(None)[self.submenu_selected = self['submenu_selected'](**self['subargs_selected'])
self.submenu_selected.show()
Menu.show(self, False)
self._last_selected_pos = self.selected_pos
]:
	i: 28(AL), 105(), 109()
	o: 178()

nname: 109
n 109(None)[]:
	i: 15(f)
	o: 110()

nname: 105
n 105(None)[]:
	i: 32(AF), 101()
	o: 110()

nname: 101
n 101(None)[]:
	i: 54(f), 78()
	o: 105()

nname: 78
n 78(None)[self.get_item_list('main_list').selected_pos = i
break
continue
]:
	i: 54(t)
	o: 101()

nname: 54
n 54(isinstance(it, sub_to_show))[for i, it in enumerate(self.get_item_list('main_list')):
]:
	i: 32(for)
	o: 78(t), 101(f)

nname: 32
n 32(None)[]:
	i: 28(loop)
	o: 54(for), 105(AF)

nname: 28
n 28(None)[]:
	i: 15(t)
	o: 32(loop), 110(AL)

nname: 15
n 15(sub_to_show is not None)[]:
	i: 0(t)
	o: 28(t), 109(f)

nname: 0
n 0(self._submenus != [])[]:
	i: 
	o: 15(t), 177(f)

nname: 178
n 178(None)[return None
]:
	i: 110(), 0(f)
	o: 

nname: 110
n 110(None)[self.submenu_selected = self['submenu_selected'](**self['subargs_selected'])
self.submenu_selected.show()
Menu.show(self, False)
self._last_selected_pos = self.selected_pos
]:
	i: 28(AL), 32(AF), 54(), 15(f)
	o: 178()

nname: 54
n 54(None)[for i, it in enumerate(self.get_item_list('main_list')):
if isinstance(it, sub_to_show):
	self.get_item_list('main_list').selected_pos = i
	break
	continue
]:
	i: 32(for)
	o: 110()

nname: 32
n 32(None)[]:
	i: 28(loop)
	o: 54(for), 110(AF)

nname: 28
n 28(None)[]:
	i: 15(t)
	o: 32(loop), 110(AL)

nname: 15
n 15(sub_to_show is not None)[]:
	i: 0(t)
	o: 28(t), 110(f)

nname: 0
n 0(self._submenus != [])[]:
	i: 
	o: 15(t), 178(f)

nname: 178
n 178(None)[return None
]:
	i: 110(), 0(f)
	o: 

nname: 110
n 110(None)[self.submenu_selected = self['submenu_selected'](**self['subargs_selected'])
self.submenu_selected.show()
Menu.show(self, False)
self._last_selected_pos = self.selected_pos
]:
	i: 54(), 15(f)
	o: 178()

nname: 54
n 54(None)[for i, it in enumerate(self.get_item_list('main_list')):
	if isinstance(it, sub_to_show):
		self.get_item_list('main_list').selected_pos = i
		break
		continue
]:
	i: 28(for)
	o: 110()

nname: 28
n 28(None)[]:
	i: 15(t)
	o: 54(for)

nname: 15
n 15(sub_to_show is not None)[]:
	i: 0(t)
	o: 28(t), 110(f)

nname: 0
n 0(self._submenus != [])[]:
	i: 
	o: 15(t), 178(f)

nname: 178
n 178(None)[return None
]:
	i: 110(), 0(f)
	o: 

nname: 110
n 110(None)[self.submenu_selected = self['submenu_selected'](**self['subargs_selected'])
self.submenu_selected.show()
Menu.show(self, False)
self._last_selected_pos = self.selected_pos
]:
	i: 28(), 15(f)
	o: 178()

nname: 28
n 28(None)[for i, it in enumerate(self.get_item_list('main_list')):
	if isinstance(it, sub_to_show):
		self.get_item_list('main_list').selected_pos = i
		break
		continue
]:
	i: 15(t)
	o: 110()

nname: 15
n 15(sub_to_show is not None)[]:
	i: 0(t)
	o: 28(t), 110(f)

nname: 0
n 0(self._submenus != [])[]:
	i: 
	o: 15(t), 178(f)

nname: 178
n 178(None)[return None
]:
	i: 15(), 0(f)
	o: 

nname: 15
n 15(None)[if sub_to_show is not None:
	for i, it in enumerate(self.get_item_list('main_list')):
		if isinstance(it, sub_to_show):
			self.get_item_list('main_list').selected_pos = i
			break
			continue
self.submenu_selected = self['submenu_selected'](**self['subargs_selected'])
self.submenu_selected.show()
Menu.show(self, False)
self._last_selected_pos = self.selected_pos
]:
	i: 0(t)
	o: 178()

nname: 0
n 0(self._submenus != [])[]:
	i: 
	o: 15(t), 178(f)

nname: 0
n 0(None)[if self._submenus != []:
	if sub_to_show is not None:
		for i, it in enumerate(self.get_item_list('main_list')):
			if isinstance(it, sub_to_show):
				self.get_item_list('main_list').selected_pos = i
				break
				continue
	self.submenu_selected = self['submenu_selected'](**self['subargs_selected'])
	self.submenu_selected.show()
	Menu.show(self, False)
	self._last_selected_pos = self.selected_pos
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb775006c>}
nname: 39
n 39(None)[Menu.stop(self)
]:
	i: 3(), 30(), 37(AE)
	o: 

nname: 37
n 37(None)[]:
	i: 20(f)
	o: 39(AE)

nname: 30
n 30(None)[]:
	i: 20(t)
	o: 39()

nname: 20
n 20(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 0(except)
	o: 30(t), 37(f)

nname: 3
n 3(None)[self.task_set.stop()
]:
	i: 0(try)
	o: 39()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 20(except)

nname: 20
n 20(None)[except AttributeError:
	pass
Menu.stop(self)
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	self.task_set.stop()
]:
	i: 
	o: 20()

nname: 0
n 0(None)[try:
	self.task_set.stop()
except AttributeError:
	pass
Menu.stop(self)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7748a0c>}
nname: 66
n 66(None)[pygui_globs['menustack'].swap_notebook_page()
self.toggleable = True
self.submenu_selected.toggleable = False
self.grouped_menu = True
self.submenu_selected.toggleable = True
]:
	i: 43(), 57(), 64(AE)
	o: 

nname: 64
n 64(None)[]:
	i: 47(f)
	o: 66(AE)

nname: 57
n 57(None)[]:
	i: 47(t)
	o: 66()

nname: 47
n 47(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 0(except)
	o: 57(t), 64(f)

nname: 43
n 43(None)[]:
	i: 15(), 42()
	o: 66()

nname: 42
n 42(None)[]:
	i: 3(f)
	o: 43()

nname: 15
n 15(None)[self.task_set.stop()
self.set_submenu()
]:
	i: 3(t)
	o: 43()

nname: 3
n 3(self.task_set.running)[]:
	i: 0(try)
	o: 15(t), 42(f)

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 47(except)

nname: 66
n 66(None)[pygui_globs['menustack'].swap_notebook_page()
self.toggleable = True
self.submenu_selected.toggleable = False
self.grouped_menu = True
self.submenu_selected.toggleable = True
]:
	i: 47(), 0()
	o: 

nname: 47
n 47(None)[except AttributeError:
	pass
]:
	i: 0()
	o: 66()

nname: 66
n 66(None)[pygui_globs['menustack'].swap_notebook_page()
self.toggleable = True
self.submenu_selected.toggleable = False
self.grouped_menu = True
self.submenu_selected.toggleable = True
]:
	i: 47(), 0()
	o: 

nname: 0
n 0(None)[try:
	if self.task_set.running:
		self.task_set.stop()
		self.set_submenu()
]:
	i: 
	o: 66(), 47()

self.nodes: {0: <unpyclib.structure.node instance at 0xb7748ecc>, 66: <unpyclib.structure.node instance at 0xb77506ac>, 47: <unpyclib.structure.node instance at 0xb7748bec>}
nname: 69
n 69(None)[]:
	i: 40(JA), 54(), 68()
	o: 

nname: 68
n 68(None)[]:
	i: 0(f)
	o: 69()

nname: 54
n 54(None)[self.set_selected_submenu()
]:
	i: 33(f)
	o: 69()

nname: 40
n 40(None)[self.set_submenu()
]:
	i: 33(t)
	o: 69(JA)

nname: 33
n 33(instantaneously)[]:
	i: 0(t)
	o: 40(t), 54(f)

nname: 0
n 0(ret)[list_name = 'main_list'
ret = Menu.select(self, item, list_name)
]:
	i: 
	o: 33(t), 68(f)

nname: 0
n 0(None)[list_name = 'main_list'
ret = Menu.select(self, item, list_name)
if ret:
	if instantaneously:
		self.set_submenu()
	else:
		self.set_selected_submenu()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7748c6c>}
nname: 6
n 6(None)[__doc__ = "\n    A notebook menu is a menu that handle couples of (item, sub menus).\n    When a item becomes selected, its associated sub menu is pushed automatically on the stack\n    (actually, it is kept under this menu)\n    These items are set in the main_list, so to access them, use self['main_list']\n    "
groupeable = True
lazy_selection_delay = None
def __init__(self, name, choices=None, submenus=None, subargs=None, subpos=None, *args, **args):
	if choices is not None:
		pass
	Menu.__init__(self, name, [], *args, **kw)
	if submenus is not None:
		pass
	self._submenus = []
	if subargs is not None:
		pass
	self._subargs = []
	if subpos is not None:
		pass
	self._subpos = -2
	self._getitems_keywords.update(dict(submenu_selected=(lambda : self._submenus[self.get_item_list('main_list').selected_pos]), subargs_selected=(lambda : self._subargs[self.get_item_list('main_list').selected_pos])))
	self._last_selected_pos = -1
	if self.lazy_selection_delay is not None:
		self.task_set = Task(self.set_submenu)
		self.task_set.delay = self.lazy_selection_delay
		self.set_selected_submenu = self.task_set.start
	else:
		self.set_selected_submenu = self.set_submenu
	return None

def set_submenu(self, num_page=None):
	selected_pos = self.selected_pos
	if selected_pos == self._last_selected_pos:
		return None
	if num_page is None:
		submenu = self['submenu_selected'](**self['subargs_selected'])
	else:
		submenu = self._submenus[num_page](**self._subargs[num_page])
	for subpos, menu in enumerate(pygui_globs['menustack'].menus_stack):
		if menu.type.startswith('notebook'):
			break
			continue
	submenu.switch_sub_menu(subpos)
	self.submenu_selected = submenu
	self._last_selected_pos = selected_pos
	return None

def append_page(self, item, menu, args):
	self['main_list'].append(item)
	self._submenus.append(menu)
	self._subargs.append(args)

def get_page(self, rank):
	return (self['main_list'][rank], self._submenus[rank])

def get_page_by_name(self, name):
	for it, menu in itertools.izip(self['main_list'], self._submenus):
		if it.name == name:
			return (it, menu)
			continue
	return (None, None)

def remove_page(self, rank):
	old_selected_pos = self['main_list'].selected_pos
	try:
		menu = self._submenus.pop(rank)
		del self['main_list'][rank]
		new_selected_pos = self['main_list'].selected_pos
		if old_selected_pos >= rank:
			self.set_selected_submenu()

def show(self, sub_to_show=None):
	if self._submenus != []:
		if sub_to_show is not None:
			for i, it in enumerate(self.get_item_list('main_list')):
				if isinstance(it, sub_to_show):
					self.get_item_list('main_list').selected_pos = i
					break
					continue
		self.submenu_selected = self['submenu_selected'](**self['subargs_selected'])
		self.submenu_selected.show()
		Menu.show(self, False)
		self._last_selected_pos = self.selected_pos
	return None

def stop(self):
	try:
		self.task_set.stop()
	except AttributeError:
		pass
	Menu.stop(self)

def move_to_page(self):
	try:
		if self.task_set.running:
			self.task_set.stop()
			self.set_submenu()

def select(self, item, list_name='main_list', instantaneously=False):
	list_name = 'main_list'
	ret = Menu.select(self, item, list_name)
	if ret:
		if instantaneously:
			self.set_submenu()
		else:
			self.set_selected_submenu()

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb77481cc>}
nname: 111
n 111(None)[Menu.__init__(self, choices=[], *args, **kw)
return None
]:
	i: 94(), 107()
	o: 

nname: 107
n 107(None)[]:
	i: 64(f)
	o: 111()

nname: 94
n 94(None)[]:
	i: 64(t)
	o: 111()

nname: 64
n 64(_rel_it is not None)[self.related_menu = None
]:
	i: 50(), 60()
	o: 94(t), 107(f)

nname: 60
n 60(None)[]:
	i: 29(f)
	o: 64()

nname: 50
n 50(None)[]:
	i: 29(t)
	o: 64()

nname: 29
n 29(_rel_it is not None)[_rel_it = self.related_item
]:
	i: 15(), 28()
	o: 50(t), 60(f)

nname: 28
n 28(None)[]:
	i: 0(t)
	o: 29()

nname: 15
n 15(None)[self.related_item = related_item
]:
	i: 0(f)
	o: 29()

nname: 0
n 0(hasattr(self, 'related_item'))[]:
	i: 
	o: 15(f), 28(t)

nname: 64
n 64(None)[self.related_menu = None
if _rel_it is not None:
	pass
Menu.__init__(self, choices=[], *args, **kw)
return None
]:
	i: 0()
	o: 

nname: 0
n 0(None)[if not hasattr(self, 'related_item'):
	self.related_item = related_item
_rel_it = self.related_item
if _rel_it is not None:
	pass
]:
	i: 
	o: 64()

nname: 0
n 0(None)[if not hasattr(self, 'related_item'):
	self.related_item = related_item
_rel_it = self.related_item
if _rel_it is not None:
	pass
self.related_menu = None
if _rel_it is not None:
	pass
Menu.__init__(self, choices=[], *args, **kw)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb774886c>}
nname: 110
n 110(None)[]:
	i: 36(), 95(), 109()
	o: 

nname: 109
n 109(None)[]:
	i: 50&66&82(f)
	o: 110()

nname: 95
n 95(None)[self.move_to_page()
]:
	i: 50&66&82(t)
	o: 110()

nname: 50&66&82
n 50&66&82(self.active_list == 'main_list' and isinstance(item, int) and item < 0)[]:
	i: 0(f)
	o: 95(t), 109(f)

nname: 36
n 36(None)[self.browse_selected()
]:
	i: 0(t)
	o: 110()

nname: 0
n 0(ret is not False)[ret = Menu.select(self, item, list_name, force_pos)
]:
	i: 
	o: 36(t), 50&66&82(f)

nname: 0
n 0(None)[ret = Menu.select(self, item, list_name, force_pos)
if ret is not False:
	self.browse_selected()
else:
	if self.active_list == 'main_list' and isinstance(item, int) and item < 0:
		self.move_to_page()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7748f6c>}
nname: 0
n 0(None)[self.grouped_menu = True
pygui_globs['menustack'].switch_sub_menu(self, subpos)
self.show_help()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb774846c>}
nname: 108
n 108(None)[]:
	i: 73(), 99(), 106(AE)
	o: 

nname: 106
n 106(None)[]:
	i: 89(f)
	o: 108(AE)

nname: 99
n 99(None)[]:
	i: 89(t)
	o: 108()

nname: 89
n 89(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 61(except)
	o: 99(t), 106(f)

nname: 73
n 73(None)[self.related_menu.grouped_menu = False
]:
	i: 61(try)
	o: 108()

nname: 61
n 61(None)[self.grouped_menu = True
]:
	i: 26(), 52(), 59(AE)
	o: 73(try), 89(except)

nname: 59
n 59(None)[]:
	i: 42(f)
	o: 61(AE)

nname: 52
n 52(None)[]:
	i: 42(t)
	o: 61()

nname: 42
n 42(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 0(except)
	o: 52(t), 59(f)

nname: 26
n 26(None)[self.related_menu.toggleable = False
]:
	i: 0(try)
	o: 61()

nname: 0
n 0(None)[pygui_globs['menustack'].swap_notebook_page()
self.toggleable = True
]:
	i: 
	o: 26(try), 42(except)

nname: 108
n 108(None)[]:
	i: 73()
	o: 

nname: 73
n 73(None)[try:
	self.related_menu.grouped_menu = False
except AttributeError:
	pass
]:
	i: 42(try)
	o: 108()

nname: 42
n 42(None)[except AttributeError:
	pass
self.grouped_menu = True
]:
	i: 0()
	o: 73(try)

nname: 0
n 0(None)[pygui_globs['menustack'].swap_notebook_page()
self.toggleable = True
try:
	self.related_menu.toggleable = False
]:
	i: 
	o: 42()

nname: 73
n 73(None)[try:
	self.related_menu.grouped_menu = False
except AttributeError:
	pass
]:
	i: 0(try)
	o: 

nname: 0
n 0(None)[pygui_globs['menustack'].swap_notebook_page()
self.toggleable = True
try:
	self.related_menu.toggleable = False
except AttributeError:
	pass
self.grouped_menu = True
]:
	i: 
	o: 73(try)

nname: 0
n 0(None)[pygui_globs['menustack'].swap_notebook_page()
self.toggleable = True
try:
	self.related_menu.toggleable = False
except AttributeError:
	pass
self.grouped_menu = True
try:
	self.related_menu.grouped_menu = False
except AttributeError:
	pass
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7748a0c>}
nname: 6
n 6(None)[__doc__ = '\n    This menu is the item-associated menu of the Notebook.\n    It is almost a generic menu, excepted the special events management to toggle\n    with the Notebook menu\n    '
toggleable = True
def __init__(self, related_item=None, *args, **args):
	if not hasattr(self, 'related_item'):
		self.related_item = related_item
	_rel_it = self.related_item
	if _rel_it is not None:
		pass
	self.related_menu = None
	if _rel_it is not None:
		pass
	Menu.__init__(self, choices=[], *args, **kw)
	return None

def select(self, item, list_name=None, force_pos=False):
	ret = Menu.select(self, item, list_name, force_pos)
	if ret is not False:
		self.browse_selected()
	else:
		if self.active_list == 'main_list' and isinstance(item, int) and item < 0:
			self.move_to_page()

def switch_sub_menu(self, subpos):
	self.grouped_menu = True
	pygui_globs['menustack'].switch_sub_menu(self, subpos)
	self.show_help()

def move_to_page(self):
	pygui_globs['menustack'].swap_notebook_page()
	self.toggleable = True
	try:
		self.related_menu.toggleable = False
	except AttributeError:
		pass
	self.grouped_menu = True
	try:
		self.related_menu.grouped_menu = False
	except AttributeError:
		pass

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7746f0c>}
nname: 0
n 0(None)[from __future__ import absolute_import
import itertools
from peewee.debug import PRINT_EXCEPTION
from peewee.notifier import Task
from .core import Menu
from pygui.shared import pygui_globs
from pygui.eventmanager.menus import MenuEventHandler
class NotebookMenu(Menu):
	__doc__ = "\n    A notebook menu is a menu that handle couples of (item, sub menus).\n    When a item becomes selected, its associated sub menu is pushed automatically on the stack\n    (actually, it is kept under this menu)\n    These items are set in the main_list, so to access them, use self['main_list']\n    "
	groupeable = True
	lazy_selection_delay = None
	def __init__(self, name, choices=None, submenus=None, subargs=None, subpos=None, *args, **args):
		if choices is not None:
			pass
		Menu.__init__(self, name, [], *args, **kw)
		if submenus is not None:
			pass
		self._submenus = []
		if subargs is not None:
			pass
		self._subargs = []
		if subpos is not None:
			pass
		self._subpos = -2
		self._getitems_keywords.update(dict(submenu_selected=(lambda : self._submenus[self.get_item_list('main_list').selected_pos]), subargs_selected=(lambda : self._subargs[self.get_item_list('main_list').selected_pos])))
		self._last_selected_pos = -1
		if self.lazy_selection_delay is not None:
			self.task_set = Task(self.set_submenu)
			self.task_set.delay = self.lazy_selection_delay
			self.set_selected_submenu = self.task_set.start
		else:
			self.set_selected_submenu = self.set_submenu
		return None

	def set_submenu(self, num_page=None):
		selected_pos = self.selected_pos
		if selected_pos == self._last_selected_pos:
			return None
		if num_page is None:
			submenu = self['submenu_selected'](**self['subargs_selected'])
		else:
			submenu = self._submenus[num_page](**self._subargs[num_page])
		for subpos, menu in enumerate(pygui_globs['menustack'].menus_stack):
			if menu.type.startswith('notebook'):
				break
				continue
		submenu.switch_sub_menu(subpos)
		self.submenu_selected = submenu
		self._last_selected_pos = selected_pos
		return None

	def append_page(self, item, menu, args):
		self['main_list'].append(item)
		self._submenus.append(menu)
		self._subargs.append(args)

	def get_page(self, rank):
		return (self['main_list'][rank], self._submenus[rank])

	def get_page_by_name(self, name):
		for it, menu in itertools.izip(self['main_list'], self._submenus):
			if it.name == name:
				return (it, menu)
				continue
		return (None, None)

	def remove_page(self, rank):
		old_selected_pos = self['main_list'].selected_pos
		try:
			menu = self._submenus.pop(rank)
			del self['main_list'][rank]
			new_selected_pos = self['main_list'].selected_pos
			if old_selected_pos >= rank:
				self.set_selected_submenu()

	def show(self, sub_to_show=None):
		if self._submenus != []:
			if sub_to_show is not None:
				for i, it in enumerate(self.get_item_list('main_list')):
					if isinstance(it, sub_to_show):
						self.get_item_list('main_list').selected_pos = i
						break
						continue
			self.submenu_selected = self['submenu_selected'](**self['subargs_selected'])
			self.submenu_selected.show()
			Menu.show(self, False)
			self._last_selected_pos = self.selected_pos
		return None

	def stop(self):
		try:
			self.task_set.stop()
		except AttributeError:
			pass
		Menu.stop(self)

	def move_to_page(self):
		try:
			if self.task_set.running:
				self.task_set.stop()
				self.set_submenu()

	def select(self, item, list_name='main_list', instantaneously=False):
		list_name = 'main_list'
		ret = Menu.select(self, item, list_name)
		if ret:
			if instantaneously:
				self.set_submenu()
			else:
				self.set_selected_submenu()



class NotebookSubMenu(Menu):
	__doc__ = '\n    This menu is the item-associated menu of the Notebook.\n    It is almost a generic menu, excepted the special events management to toggle\n    with the Notebook menu\n    '
	toggleable = True
	def __init__(self, related_item=None, *args, **args):
		if not hasattr(self, 'related_item'):
			self.related_item = related_item
		_rel_it = self.related_item
		if _rel_it is not None:
			pass
		self.related_menu = None
		if _rel_it is not None:
			pass
		Menu.__init__(self, choices=[], *args, **kw)
		return None

	def select(self, item, list_name=None, force_pos=False):
		ret = Menu.select(self, item, list_name, force_pos)
		if ret is not False:
			self.browse_selected()
		else:
			if self.active_list == 'main_list' and isinstance(item, int) and item < 0:
				self.move_to_page()

	def switch_sub_menu(self, subpos):
		self.grouped_menu = True
		pygui_globs['menustack'].switch_sub_menu(self, subpos)
		self.show_help()

	def move_to_page(self):
		pygui_globs['menustack'].swap_notebook_page()
		self.toggleable = True
		try:
			self.related_menu.toggleable = False
		except AttributeError:
			pass
		self.grouped_menu = True
		try:
			self.related_menu.grouped_menu = False
		except AttributeError:
			pass



]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb773df4c>}
from __future__ import absolute_import
import itertools
from peewee.debug import PRINT_EXCEPTION
from peewee.notifier import Task
from .core import Menu
from pygui.shared import pygui_globs
from pygui.eventmanager.menus import MenuEventHandler
class NotebookMenu(Menu):
	__doc__ = "\n    A notebook menu is a menu that handle couples of (item, sub menus).\n    When a item becomes selected, its associated sub menu is pushed automatically on the stack\n    (actually, it is kept under this menu)\n    These items are set in the main_list, so to access them, use self['main_list']\n    "
	groupeable = True
	lazy_selection_delay = None
	def __init__(self, name, choices=None, submenus=None, subargs=None, subpos=None, *args, **args):
		if choices is not None:
			pass
		Menu.__init__(self, name, [], *args, **kw)
		if submenus is not None:
			pass
		self._submenus = []
		if subargs is not None:
			pass
		self._subargs = []
		if subpos is not None:
			pass
		self._subpos = -2
		self._getitems_keywords.update(dict(submenu_selected=(lambda : self._submenus[self.get_item_list('main_list').selected_pos]), subargs_selected=(lambda : self._subargs[self.get_item_list('main_list').selected_pos])))
		self._last_selected_pos = -1
		if self.lazy_selection_delay is not None:
			self.task_set = Task(self.set_submenu)
			self.task_set.delay = self.lazy_selection_delay
			self.set_selected_submenu = self.task_set.start
		else:
			self.set_selected_submenu = self.set_submenu
		return None

	def set_submenu(self, num_page=None):
		selected_pos = self.selected_pos
		if selected_pos == self._last_selected_pos:
			return None
		if num_page is None:
			submenu = self['submenu_selected'](**self['subargs_selected'])
		else:
			submenu = self._submenus[num_page](**self._subargs[num_page])
		for subpos, menu in enumerate(pygui_globs['menustack'].menus_stack):
			if menu.type.startswith('notebook'):
				break
				continue
		submenu.switch_sub_menu(subpos)
		self.submenu_selected = submenu
		self._last_selected_pos = selected_pos
		return None

	def append_page(self, item, menu, args):
		self['main_list'].append(item)
		self._submenus.append(menu)
		self._subargs.append(args)

	def get_page(self, rank):
		return (self['main_list'][rank], self._submenus[rank])

	def get_page_by_name(self, name):
		for it, menu in itertools.izip(self['main_list'], self._submenus):
			if it.name == name:
				return (it, menu)
				continue
		return (None, None)

	def remove_page(self, rank):
		old_selected_pos = self['main_list'].selected_pos
		try:
			menu = self._submenus.pop(rank)
			del self['main_list'][rank]
			new_selected_pos = self['main_list'].selected_pos
			if old_selected_pos >= rank:
				self.set_selected_submenu()

	def show(self, sub_to_show=None):
		if self._submenus != []:
			if sub_to_show is not None:
				for i, it in enumerate(self.get_item_list('main_list')):
					if isinstance(it, sub_to_show):
						self.get_item_list('main_list').selected_pos = i
						break
						continue
			self.submenu_selected = self['submenu_selected'](**self['subargs_selected'])
			self.submenu_selected.show()
			Menu.show(self, False)
			self._last_selected_pos = self.selected_pos
		return None

	def stop(self):
		try:
			self.task_set.stop()
		except AttributeError:
			pass
		Menu.stop(self)

	def move_to_page(self):
		try:
			if self.task_set.running:
				self.task_set.stop()
				self.set_submenu()

	def select(self, item, list_name='main_list', instantaneously=False):
		list_name = 'main_list'
		ret = Menu.select(self, item, list_name)
		if ret:
			if instantaneously:
				self.set_submenu()
			else:
				self.set_selected_submenu()



class NotebookSubMenu(Menu):
	__doc__ = '\n    This menu is the item-associated menu of the Notebook.\n    It is almost a generic menu, excepted the special events management to toggle\n    with the Notebook menu\n    '
	toggleable = True
	def __init__(self, related_item=None, *args, **args):
		if not hasattr(self, 'related_item'):
			self.related_item = related_item
		_rel_it = self.related_item
		if _rel_it is not None:
			pass
		self.related_menu = None
		if _rel_it is not None:
			pass
		Menu.__init__(self, choices=[], *args, **kw)
		return None

	def select(self, item, list_name=None, force_pos=False):
		ret = Menu.select(self, item, list_name, force_pos)
		if ret is not False:
			self.browse_selected()
		else:
			if self.active_list == 'main_list' and isinstance(item, int) and item < 0:
				self.move_to_page()

	def switch_sub_menu(self, subpos):
		self.grouped_menu = True
		pygui_globs['menustack'].switch_sub_menu(self, subpos)
		self.show_help()

	def move_to_page(self):
		pygui_globs['menustack'].swap_notebook_page()
		self.toggleable = True
		try:
			self.related_menu.toggleable = False
		except AttributeError:
			pass
		self.grouped_menu = True
		try:
			self.related_menu.grouped_menu = False
		except AttributeError:
			pass



